#!/bin/bash
#
# $Id$
#

if [ -z "$OPENARS_HOME" ]; then
    echo "not defined OPENARS_HOME variable. exit 1."
    exit 1    
fi

cd $OPENARS_HOME
set -- $OPENARS_HOME
echo "modify scripts ..." 
scr_list=`find . -name "*.sh"`
for file in $scr_list
do
    cat $file | sed -e 's!^\([^#]*\. \)\$OPENARS_HOME\(.*\)$!\1'$1'\2!' \
	      | sed -e 's!^\([^#]*\source \)\$OPENARS_HOME\(.*\)$!\1'$1'\2!' > $file.mod
    mv $file.mod $file	
    chmod +x $file
done

exit 0
